home *** CD-ROM | disk | FTP | other *** search
/ NeXT Education Software Sampler 1992 Fall / NeXT Education Software Sampler 1992 Fall.iso / Programming / Source / tess / tess-1.0 / cm.m < prev    next >
Encoding:
Text File  |  1992-06-30  |  891 b   |  54 lines

  1. #import "aGroup-inter.h"
  2. #import "aGroup.h"
  3. #import "cm.h"
  4.  
  5. @implementation cm
  6. - defaultConfig
  7. {
  8.   [self noAngleSetup];
  9.   return self;
  10. }
  11.  
  12. - resizeGenerator
  13. {
  14.   latticesize.height = frame.size.height;
  15.   latticesize.width = frame.size.width;
  16.   upx = latticesize.width / 2;
  17.   upy = latticesize.height ;
  18.   overx = latticesize.width;
  19.   gravy = 0.0;
  20.   gravx = overx/2;
  21.   return self;
  22. }
  23.  
  24. - clip: (NXCoord) x: (NXCoord) y 
  25.   PSmoveto(x,y);
  26.   PSrlineto(upx,upy);
  27.   PSrlineto(upx,-upy);
  28.   PSclosepath();
  29.   PSclip();
  30.   return self;
  31. }
  32.  
  33. - makeLatticeUnitAt: (NXPoint *) point fromImage: srcimg 
  34. {
  35.   id imgrep;
  36.   NXPoint pt;
  37.   
  38.   pt.x = - point->x ;
  39.   pt.y = - point->y ;
  40.   imgrep = [srcimg bestRepresentation];
  41.   PSgsave();
  42.   [self clip:0.0:0.0];
  43.   [imgrep drawAt: &pt];
  44.   PSgrestore();
  45.   PSgsave();
  46.   reflect(0.0);
  47.   [self clip:0.0:0.0];
  48.   [imgrep drawAt: &pt];
  49.   PSgrestore();
  50.   return self;
  51. }
  52. @end
  53.